package com.ruoyi.rsikManage.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.rsikManage.domain.TMapAvoidance;
import com.ruoyi.rsikManage.service.ITMapAvoidanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2021-12-09
 *
 */
@RestController
@RequestMapping("/system/avoidance")
public class TMapAvoidanceController extends BaseController
{


    @Autowired
    private ITMapAvoidanceService tMapAvoidanceService;

    /**
     * 查询【请填写功能名称】列表
     *
     */
    @GetMapping("/list")
    public TableDataInfo list(TMapAvoidance tMapAvoidance)
    {
        startPage();
        List<TMapAvoidance> list = tMapAvoidanceService.selectTMapAvoidanceList(tMapAvoidance);
        return getDataTable(list);
    }

    @PostMapping("/list/top")
    public TableDataInfo listTop()
    {

//      startPage();
        List<Map> maps = tMapAvoidanceService.selectTopList();
        return getDataTable(maps);
    }

    @PostMapping("/shortList")
    public AjaxResult getShortList(@RequestBody TMapAvoidance tMapAvoidance)
    {
        List<Map<String,Object>> list = tMapAvoidanceService.getShortList(tMapAvoidance);
        return AjaxResult.success(list);
    }


    @GetMapping("/pictureOfGas")
    public TableDataInfo getpictureOfGas(TMapAvoidance tMapAvoidance)
    {
        startPage();
        List<TMapAvoidance> list = tMapAvoidanceService.selectTMapAvoidanceList(tMapAvoidance);
        return getDataTable(list);
    }

    @PostMapping("/pictureOfGas")
    public TableDataInfo getpictureOfGas2(TMapAvoidance tMapAvoidance)
    {
        startPage();
        List<TMapAvoidance> list = tMapAvoidanceService.selectTMapAvoidanceList(tMapAvoidance);
        return getDataTable(list);
    }
    /**
     *
     * 
     * 获取【请填写功能名称】详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tMapAvoidanceService.selectTMapAvoidanceById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PostMapping
    public AjaxResult add(@RequestBody TMapAvoidance tMapAvoidance)
    {
        return toAjax(tMapAvoidanceService.insertTMapAvoidance(tMapAvoidance));
    }

    /**
     * 修改【请填写功能名称】
     *
     */
    @PutMapping
    public AjaxResult edit(@RequestBody TMapAvoidance tMapAvoidance)
    {
        return toAjax(tMapAvoidanceService.updateTMapAvoidance(tMapAvoidance));
    }

    /**
     * 删除【请填写功能名称】
     *
     *
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tMapAvoidanceService.deleteTMapAvoidanceByIds(ids));
    }



}
